/* eslint-disable consistent-return */
/* eslint-disable react/jsx-indent */
import React, { PureComponent } from 'react';
import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { message, Row, Col, Modal, Select, Button, DatePicker, InputNumber } from 'antd';
import moment from 'moment';
import styles from './index.less';
import DictCode from '../../../components/DictCode';
import { urlParse } from '@/utils/utils';
import HOCSelect from '@/components/AntDesign/Select';

const FormItem = Form.Item;
const { Option } = Select;
const { MonthPicker } = DatePicker;

@Form.create()
class LocalPolicy extends PureComponent {
  state = {
    switchFlag: true,
    disabledSwitch: false,
    modalVisible: false,
    defaultSwitch: true,
    areaId: '',
    isnableState: '',
    effectiveTime: '0',
    duplicateTaskModal: false, // 生成替数任务弹框
    taskObj: {}, // 替数任务数据
    differHdlWay: null, // 差额
  };

  componentDidMount() {
    const { location } = this.props;
    const url = location.search;
    const { state, areaId } = urlParse(url);
    this.setState({
      areaId,
    });
    if (state) {
      this.setState({
        isnableState: state,
      });
    } else {
      this.setState({
        isnableState: '3',
      });
    }
  }

  // 新增数据
  addDate = () => {
    this.setState({
      effectiveTime: '0',
    });
    const { form } = this.props;
    // const { areaId } = this.state;
    form.resetFields([
      'empTime',
      'corpBaseUprLmt',
      'empBaseUprLmt',
      'corpBaseLwrLmt',
      'empBaseLwrLmt',
      'corpProp',
      'empProp',
      'corpFixSum',
      'empFixSum',
      'corpCarryRule',
      'empCarryRule',
      'corpBaseCarryRule',
      'empBaseCarryRule',
      'govPostTime',
    ]);
    const { dispatch } = this.props;
    const accuLsPkg = form.getFieldsValue(['accuLsPkgName']);
    if (
      accuLsPkg.accuLsPkgName === undefined ||
      accuLsPkg.accuLsPkgName === '' ||
      accuLsPkg.accuLsPkgName === null
    ) {
      message.warning('组合名称名称不能为空！');
      return;
    }
    this.setState({
      switchFlag: true,
      modalVisible: true,
      defaultSwitch: false,
    });
    dispatch({
      type: 'localpolicy/changeModify',
      payload: '2',
    });
    // if (String(localpolicy.providentFundPolicyId) === '') {
    //   // 判断政策名称不能为空( 只执行一次 )
    //   dispatch({
    //     type: 'localpolicy/combinationName',
    //     payload: {
    //       areaId,
    //       accuLsPkgName: accuLsPkg.accuLsPkgName,
    //       locStdName: accuLsPkg.accuLsPkgName,
    //     },
    //     callback: () => {},
    //   });
    // }
  };

  // 模态框显隐
  handleModalVisible = flag => {
    this.setState({
      modalVisible: !!flag,
    });
  };

  // 提交数据
  submitData = () => {
    const { form } = this.props;
    const { areaId } = this.state;
    const accuLsPkg = form.getFieldsValue(['accuLsPkgName']);
    form.validateFields((err, values) => {
      if (!err) {
        const temp = values;
        const { dispatch, localpolicy } = this.props;
        temp.locStdName = temp.accuLsPkgName;
        if (Number(localpolicy.isModify) === 2) {
          if (localpolicy.providentFundPolicyId) {
            const parameter = {
              ...temp,
              accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
              isModify: localpolicy.isModify, // 是新增还是修改
              beginDate: moment(temp.empTime).valueOf(),
              govPostTime: moment(temp.govPostTime).valueOf(),
            };
            dispatch({
              type: 'localpolicy/saveProvidentFund',
              payload: parameter,
              callback: response => {
                if (response.success) {
                  this.setState({
                    modalVisible: false,
                  });
                  // 判断是否展示地区重复比例
                  if (
                    response.data &&
                    response.data.isShowRepRateFlag &&
                    response.data.isShowRepRateFlag === 1
                  ) {
                    // 是
                    Modal.confirm({
                      title: `当前地区下已存在同比例的公积金组合，是否确认继续添加？`,
                      okText: '确认',
                      cancelText: '取消',
                      onOk: () => {
                        dispatch({
                          type: 'localpolicy/submitInsertAccuLs',
                          payload: {
                            ...response.data.requestAccuLsInsertDto,
                          },
                        }).then(res => {
                          if (res.success) {
                            // 判断生成替数任务规则弹框是否显示
                            if (
                              response.data.isShowFlag &&
                              Number(response.data.isShowFlag) === 1
                            ) {
                              this.setState({
                                duplicateTaskModal: true,
                                taskObj: response.data,
                              });
                            } else {
                              const paramet = {
                                accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
                              };
                              // 添加完以后获取该缴费人员下该险种下的所有信息
                              dispatch({
                                type: 'localpolicy/providentFundInformation',
                                payload: paramet,
                                callback: result => {
                                  if (result.success) {
                                    message.success('保存成功！');
                                  }
                                },
                              });
                            }
                          } else {
                            message.warning(res.message || '服务端未知错误');
                          }
                        });
                      },
                    });
                  } else if (response.data.isShowFlag && Number(response.data.isShowFlag) === 1) {
                    // 否
                    // 判断生成替数任务规则弹框是否显示
                    this.setState({
                      duplicateTaskModal: true,
                      taskObj: response.data,
                    });
                  } else {
                    const paramet = {
                      accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
                    };
                    // 添加完以后获取该缴费人员下该险种下的所有信息
                    dispatch({
                      type: 'localpolicy/providentFundInformation',
                      payload: paramet,
                      callback: res => {
                        if (res.success) {
                          message.success('保存成功！');
                        }
                      },
                    });
                  }
                }
              },
            });
          } else {
            dispatch({
              type: 'localpolicy/combinationName',
              payload: {
                areaId,
                accuLsPkgName: accuLsPkg.accuLsPkgName,
                locStdName: accuLsPkg.accuLsPkgName,
              },
              callback: (results) => {
                const parameter = {
                  ...temp,
                  accuLsPkgId: results, // 组id
                  isModify: localpolicy.isModify, // 是新增还是修改
                  beginDate: moment(temp.empTime).valueOf(),
                  govPostTime: moment(temp.govPostTime).valueOf(),
                };
                dispatch({
                  type: 'localpolicy/saveProvidentFund',
                  payload: parameter,
                  callback: response => {
                    if (response.success) {
                      this.setState({
                        modalVisible: false,
                      });
                      // 判断是否展示地区重复比例
                      if (
                        response.data &&
                        response.data.isShowRepRateFlag &&
                        response.data.isShowRepRateFlag === 1
                      ) {
                        // 是
                        Modal.confirm({
                          title: `当前地区下已存在同比例的公积金组合，是否确认继续添加？`,
                          okText: '确认',
                          cancelText: '取消',
                          onOk: () => {
                            dispatch({
                              type: 'localpolicy/submitInsertAccuLs',
                              payload: {
                                ...response.data.requestAccuLsInsertDto,
                              },
                            }).then(res => {
                              if (res.success) {
                                // 判断生成替数任务规则弹框是否显示
                                if (
                                  response.data.isShowFlag &&
                                  Number(response.data.isShowFlag) === 1
                                ) {
                                  this.setState({
                                    duplicateTaskModal: true,
                                    taskObj: response.data,
                                  });
                                } else {
                                  const paramet = {
                                    accuLsPkgId: results, // 组id
                                  };
                                  // 添加完以后获取该缴费人员下该险种下的所有信息
                                  dispatch({
                                    type: 'localpolicy/providentFundInformation',
                                    payload: paramet,
                                    callback: result => {
                                      if (result.success) {
                                        message.success('保存成功！');
                                      }
                                    },
                                  });
                                }
                              } else {
                                message.warning(res.message || '服务端未知错误');
                              }
                            });
                          },
                        });
                      } else if (
                        response.data.isShowFlag &&
                        Number(response.data.isShowFlag) === 1
                      ) {
                        // 否
                        // 判断生成替数任务规则弹框是否显示
                        this.setState({
                          duplicateTaskModal: true,
                          taskObj: response.data,
                        });
                      } else {
                        const paramet = {
                          accuLsPkgId: results, // 组id
                        };
                        // 添加完以后获取该缴费人员下该险种下的所有信息
                        dispatch({
                          type: 'localpolicy/providentFundInformation',
                          payload: paramet,
                          callback: res => {
                            if (res.success) {
                              message.success('保存成功！');
                            }
                          },
                        });
                      }
                    }
                  },
                });
              },
            });
          }
        } else {
          const parameter = {
            ...temp,
            locStdId: localpolicy.viewDataMessage.locStdId, // 这个险种下的某个时间段的修改
            isModify: localpolicy.isModify, // 是新增还是修改
            vno: localpolicy.viewDataMessage.vno,
            beginDate: moment(temp.empTime).valueOf(),
            govPostTime: moment(temp.govPostTime).valueOf(),
          };
          dispatch({
            type: 'localpolicy/saveProvidentFund',
            payload: parameter,
            callback: response => {
              if (response.success) {
                this.setState({
                  modalVisible: false,
                });
                // 判断生成替数任务规则弹框是否显示
                if (response.data && response.data.isShowFlag) {
                  if (Number(response.data.isShowFlag) === 1) {
                    this.setState({
                      duplicateTaskModal: true,
                      taskObj: response.data,
                    });
                  } else {
                    const paramet = {
                      accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
                    };
                    // 添加完以后获取该缴费人员下该险种下的所有信息
                    dispatch({
                      type: 'localpolicy/providentFundInformation',
                      payload: paramet,
                      callback: result => {
                        if (result.success) {
                          message.success('保存成功！');
                        }
                      },
                    });
                  }
                }
              }
            },
          });
        }
      }
    });
  };

  // 只有修改和删除并存，，     保存 和 取消
  // 删除时间
  deleteTime = timeitem => {
    const { dispatch, localpolicy } = this.props;
    const parame = {
      list: [
        {
          locStdId: timeitem.locStdId,
          vno: timeitem.vno,
        },
      ],
    };
    dispatch({
      type: 'localpolicy/deleteProvidentTimes',
      payload: parame,
      callback: response => {
        if (response.success) {
          message.success('删除成功！');
          const paramet = {
            accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
          };
          // 删除完以后获取该缴费人员下该险种下的所有信息
          dispatch({
            type: 'localpolicy/providentFundInformation',
            payload: paramet,
          });
        }
      },
    });
  };

  // 修改险种
  saveRiskmessage = (timeitem, e, index) => {
    const { form, dispatch } = this.props;
    form.resetFields([
      'empTime',
      'corpBaseUprLmt',
      'empBaseUprLmt',
      'corpBaseLwrLmt',
      'empBaseLwrLmt',
      'corpProp',
      'empProp',
      'corpFixSum',
      'empFixSum',
      'corpCarryRule',
      'empCarryRule',
      'corpBaseCarryRule',
      'empBaseCarryRule',
      'govPostTime',
    ]);
    this.setState({
      defaultSwitch: true,
      modalVisible: true,
      effectiveTime: index,
    });
    dispatch({
      type: 'localpolicy/viewData',
      payload: { timeitem, e },
    });
  };

  // 点击查看右侧的
  detailItem = timeitem => {
    const { dispatch } = this.props;
    dispatch({
      type: 'localpolicy/viewData',
      payload: { timeitem },
    });
  };

  // 禁止的时间
  disabledDate = (startValue, limitValue) => {
    if (!startValue) {
      return false;
    }
    return startValue.valueOf() < moment(limitValue).valueOf();
  };

  // 切换险种
  bizTabChange = value => {
    const { dispatch, localpolicy } = this.props;
    dispatch({
      type: 'localpolicy/changeinsuranceMessage',
      payload: { value },
    });
    const paramet = {
      insLsPkgId: localpolicy.groupId,
      joinIdeId: localpolicy.payerIds,
      type: value,
    };
    // 添加完以后获取该缴费人员下该险种下的所有信息
    dispatch({
      type: 'localpolicy/insuranceInformation',
      payload: paramet,
    });
    dispatch({
      type: 'localpolicy/clearDefault',
      payload: {},
    });
  };

  // 选择 企业进位规则 和 个人进位规则
  selectChange = (name, e) => {
    const { dispatch, localpolicy } = this.props;
    if (localpolicy.viewDataMessage.corpCarryRule || localpolicy.viewDataMessage.empCarryRule) {
      dispatch({
        type: 'localpolicy/selectMessage',
        payload: { name, e },
      });
    }
  };

  // 隐藏生成替数任务弹框
  duplicateTaskCancel = () => {
    this.setState({ duplicateTaskModal: false });
  };

  // 生成替数任务弹框的确定按钮
  duplicateTaskOk = () => {
    const { differHdlWay, taskObj } = this.state;
    const { dispatch, localpolicy } = this.props;
    if (!differHdlWay) {
      message.warning('请选择差额账单处理方式');
      return false;
    }
    // 替数任务提交数据
    dispatch({
      type: 'localpolicy/accuReplacePolicy',
      payload: {
        ...taskObj,
        differHdlWay,
      },
    }).then(res => {
      if (res.success) {
        const paramet = {
          accuLsPkgId: localpolicy.providentFundPolicyId, // 组id
        };
        // 添加完以后获取该缴费人员下该险种下的所有信息
        dispatch({
          type: 'localpolicy/providentFundInformation',
          payload: paramet,
        });
        this.setState({ duplicateTaskModal: false });
      } else {
        message.warning(res.message || '公积金生成替数任务：服务器端错误');
      }
    });
  };

  // 选择差额账单数据
  getValue = e => {
    this.setState({
      differHdlWay: e.target.value,
    });
  };

  render() {
    const { form, localpolicy, insuranceInformationData, isaddBtn } = this.props;
    const formItemLayout = {
      labelCol: { md: { span: 11 } },
      wrapperCol: { md: { span: 10 } },
    };
    const formItemLayoutModal = {
      labelCol: { md: { span: 10 } },
      wrapperCol: { md: { span: 10 } },
    };
    const formModalItemLayout = {
      labelCol: { md: { span: 5 } },
      wrapperCol: { md: { span: 17, offset: 0 } },
    };
    const formItemRadioLayout = {
      labelCol: { md: { span: 8 } },
      wrapperCol: { md: { span: 14, offset: 0 } },
    };
    const { getFieldDecorator } = form;
    const {
      switchFlag,
      modalVisible,
      isnableState,
      defaultSwitch,
      duplicateTaskModal,
      taskObj,
      disabledSwitch,
      effectiveTime,
    } = this.state;
    return (
      <Form>
        <Row style={{ width: '800px', margin: '0 auto' }}>
          <Col style={{ width: '200px', float: 'left', background: '#fafafa' }}>
            <Col
              style={{
                height: 380,
                minHeight: 380,
                lineHeight: '25px',
                overflow: 'hidden',
                overflowY: 'scroll',
              }}
            >
              {Number(isaddBtn) === 1 ? (
                <Button
                  style={{ width: '100px', margin: '10px 40px 0 40px' }}
                  type="primary"
                  onClick={() => this.addDate(2)}
                >
                  + 新增年月
                </Button>
              ) : null}
              {insuranceInformationData.length === 0
                ? null
                : insuranceInformationData.map((timeitem, itemindex) => (
                    <div
                      className={timeitem.active ? styles.activeButton : styles.noActiveButton}
                      onClick={() => this.detailItem(timeitem, 1)}
                      style={{
                        marginRight: 5,
                        marginTop: 10,
                        height: '48px',
                        lineHeight: '48px',
                        float: 'left',
                        width: '200px',
                        padding: '0 0 0 60px',
                        cursor: 'pointer',
                      }}
                    >
                      <span style={{ float: 'left' }}>
                        {moment(timeitem.beginDate).format('YYYY-MM')}
                      </span>
                      <div style={{ float: 'left', lineHeight: '50px' }}>
                        {Number(isaddBtn) === 1 ? (
                          <div style={{ float: 'left' }}>
                            {switchFlag ? (
                              <a
                                style={{ margin: '0 0 0 25px' }}
                                onClick={() => this.saveRiskmessage(timeitem, 1, itemindex)}
                              >
                                <EditOutlined />
                              </a>
                            ) : (
                              <a
                                style={{ marginLeft: '10px' }}
                                onClick={() => this.saveRiskmessage(timeitem, 1, itemindex)}
                              >
                                <EditOutlined />
                              </a>
                            )}
                          </div>
                        ) : null}
                        {Number(itemindex) === 0 &&
                        Number(isaddBtn) === 1 &&
                        String(isnableState) === '1' ? (
                          <a
                            style={{ marginLeft: '10px', float: 'left' }}
                            onClick={() => this.deleteTime(timeitem)}
                          >
                            <DeleteOutlined />
                          </a>
                        ) : null}
                      </div>
                    </div>
                  ))}
            </Col>
          </Col>
          <Col style={{ width: '540px', float: 'left', marginLeft: '20px' }}>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数上限">
                  <span>
                    {localpolicy.viewDataMessage.corpBaseUprLmt ||
                      (localpolicy.viewDataMessage.corpBaseUprLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数上限">
                  <span>
                    {localpolicy.viewDataMessage.empBaseUprLmt ||
                      (localpolicy.viewDataMessage.empBaseUprLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数下限">
                  <span>
                    {localpolicy.viewDataMessage.corpBaseLwrLmt ||
                      (localpolicy.viewDataMessage.corpBaseLwrLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数下限">
                  <span>
                    {localpolicy.viewDataMessage.empBaseLwrLmt ||
                      (localpolicy.viewDataMessage.empBaseLwrLmt === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业基数进位规则">
                  <span>{localpolicy.viewDataMessage.corpBaseCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人基数进位规则">
                  <span>{localpolicy.viewDataMessage.empBaseCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
            </Row>

            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业缴费比例">
                  <Col span={10}>
                    <span>
                      {localpolicy.viewDataMessage.corpProp ||
                        (localpolicy.viewDataMessage.corpProp === 0 ? 0 : '--')}
                    </span>
                  </Col>
                  <Col span={1} offset={1} style={{ position: 'absolute', top: 0, right: '-45px' }}>
                    %
                  </Col>
                </FormItem>
              </Col>

              <Col span={12}>
                <FormItem {...formItemLayout} label="个人缴费比例">
                  <Col span={10}>
                    <span>
                      {localpolicy.viewDataMessage.empProp ||
                        (localpolicy.viewDataMessage.empProp === 0 ? 0 : '--')}
                    </span>
                  </Col>
                  <Col span={1} offset={1} style={{ position: 'absolute', top: 0, right: '-45px' }}>
                    %
                  </Col>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业固定金额">
                  <span>
                    {localpolicy.viewDataMessage.corpFixSum ||
                      (localpolicy.viewDataMessage.corpFixSum === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人固定金额">
                  <span>
                    {localpolicy.viewDataMessage.empFixSum ||
                      (localpolicy.viewDataMessage.empFixSum === 0 ? 0 : '--')}
                  </span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="企业缴费进位规则">
                  <span>{localpolicy.viewDataMessage.corpCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
              <Col span={12}>
                <FormItem {...formItemLayout} label="个人缴费进位规则">
                  <span>{localpolicy.viewDataMessage.empCarryRuleName || '--'}</span>
                </FormItem>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <FormItem {...formItemLayout} label="政府发文时间">
                  <span>
                    {(localpolicy.viewDataMessage &&
                      localpolicy.viewDataMessage.govPostTime &&
                      moment(localpolicy.viewDataMessage.govPostTime).format('YYYY-MM-DD HH:mm')) ||
                      '--'}
                  </span>
                </FormItem>
              </Col>
              <Col span={12} />
            </Row>
          </Col>
        </Row>

        <Modal
          width={750}
          title="时间段信息"
          visible={modalVisible}
          okText="确定"
          cancelText="取消"
          onOk={this.submitData}
          onCancel={() => this.handleModalVisible(false)}
          destroyOnClose
        >
          <Form layout="horizontal">
            <Row style={{ margin: '0 auto' }}>
              <Row>
                <FormItem {...formItemLayoutModal} label="生效时间">
                  {getFieldDecorator('empTime', {
                    rules: [{ required: true, message: '请选择时间段' }],

                    initialValue: defaultSwitch
                      ? moment(localpolicy.changeDataMessage.beginDate)
                      : null,
                  })(
                    <MonthPicker
                      format="YYYY-MM"
                      placeholder="请选择"
                      style={{ width: '220px', float: 'left' }}
                      disabled={String(effectiveTime) !== '0'}
                      disabledDate={startValue =>
                        this.disabledDate(
                          startValue,
                          localpolicy.rangeDate
                          // '2019-06'
                        )
                      }
                      allowClear={false}
                    />
                  )}
                </FormItem>
                <div
                  style={{
                    width: '100%',
                    margin: '-10px 0 24px 0',
                    borderBottom: '1px dashed #ccc',
                  }}
                />
              </Row>
              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业基数上限">
                    {getFieldDecorator('corpBaseUprLmt', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.corpBaseUprLmt,
                    })(
                      <InputNumber
                        max={99999999.99}
                        min={0}
                        placeholder="请输入"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人基数上限">
                    {getFieldDecorator('empBaseUprLmt', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.empBaseUprLmt,
                    })(
                      <InputNumber
                        placeholder="请输入"
                        max={99999999.99}
                        min={0}
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
              </Row>
              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业基数下限">
                    {getFieldDecorator('corpBaseLwrLmt', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.corpBaseLwrLmt,
                    })(
                      <InputNumber
                        max={99999999.99}
                        min={0}
                        placeholder="请输入"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人基数下限">
                    {getFieldDecorator('empBaseLwrLmt', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.empBaseLwrLmt,
                    })(
                      <InputNumber
                        max={99999999.99}
                        min={0}
                        style={{ width: '156px' }}
                        placeholder="请输入"
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
              </Row>

              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业基数进位规则">
                    {getFieldDecorator('corpBaseCarryRule', {
                      rules: [{ required: true, message: '请选择企业基数进位规则' }],
                      initialValue:
                        localpolicy.changeDataMessage &&
                        localpolicy.changeDataMessage.corpBaseCarryRule &&
                        String(localpolicy.changeDataMessage.corpBaseCarryRule),
                    })(
                      <HOCSelect
                        placeholder="请选择"
                        disabled={disabledSwitch}
                        style={{ width: '156px' }}
                        onChange={e => this.selectChange('corpCarryRule', e)}
                      >
                        {localpolicy.dictionaryData.CARRY_RULE
                          ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                              <Option value={value.itemCode}>{value.itemName}</Option>
                            ))
                          : null}
                      </HOCSelect>
                    )}
                  </FormItem>
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人基数进位规则">
                    {getFieldDecorator('empBaseCarryRule', {
                      rules: [{ required: true, message: '请选择个人基数进位规则' }],
                      initialValue:
                        localpolicy.changeDataMessage &&
                        localpolicy.changeDataMessage.empBaseCarryRule &&
                        String(localpolicy.changeDataMessage.empBaseCarryRule),
                    })(
                      <HOCSelect
                        placeholder="请选择"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                        onChange={e => this.selectChange('empBaseCarryRule', e)}
                      >
                        {localpolicy.dictionaryData.CARRY_RULE
                          ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                              <Option value={value.itemCode}>{value.itemName}</Option>
                            ))
                          : null}
                      </HOCSelect>
                    )}
                  </FormItem>
                </Col>
              </Row>

              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业缴费比例">
                    <Col span={22}>
                      {getFieldDecorator('corpProp', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: localpolicy.changeDataMessage.corpProp,
                      })(
                        <InputNumber
                          max={99.99}
                          min={0}
                          style={{ width: '140px' }}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </Col>
                    <Col
                      span={1}
                      offset={1}
                      style={{ position: 'absolute', top: '5px', right: '-145px' }}
                    >
                      %
                    </Col>
                  </FormItem>
                </Col>

                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人缴费比例">
                    <Col span={22}>
                      {getFieldDecorator('empProp', {
                        rules: [
                          {
                            required: true,
                            message: '小数点后不可超过2位',
                            pattern: /^-?\d+\.?\d{0,2}$/,
                          },
                        ],
                        initialValue: localpolicy.changeDataMessage.empProp,
                      })(
                        <InputNumber
                          max={99.99}
                          min={0}
                          style={{ width: '140px' }}
                          placeholder="请输入"
                          disabled={disabledSwitch}
                        />
                      )}
                    </Col>
                    <Col
                      span={1}
                      offset={1}
                      style={{ position: 'absolute', top: '5px', right: '-145px' }}
                    >
                      %
                    </Col>
                  </FormItem>
                </Col>
              </Row>
              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业固定金额">
                    {getFieldDecorator('corpFixSum', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.corpFixSum,
                    })(
                      <InputNumber
                        max={99999999.99}
                        min={0}
                        placeholder="请输入"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人固定金额">
                    {getFieldDecorator('empFixSum', {
                      rules: [
                        {
                          required: true,
                          message: '小数点后不可超过2位',
                          pattern: /^-?\d+\.?\d{0,2}$/,
                        },
                      ],
                      initialValue: localpolicy.changeDataMessage.empFixSum,
                    })(
                      <InputNumber
                        max={99999999.99}
                        min={0}
                        placeholder="请输入"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                      />
                    )}
                  </FormItem>
                </Col>
              </Row>
              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="企业缴费进位规则">
                    {getFieldDecorator('corpCarryRule', {
                      rules: [{ required: true, message: '请选择企业缴费进位规则' }],
                      initialValue:
                        localpolicy.changeDataMessage &&
                        localpolicy.changeDataMessage.corpCarryRule &&
                        String(localpolicy.changeDataMessage.corpCarryRule),
                    })(
                      <HOCSelect
                        placeholder="请选择"
                        disabled={disabledSwitch}
                        style={{ width: '156px' }}
                        onChange={e => this.selectChange('corpCarryRule', e)}
                      >
                        {localpolicy.dictionaryData.CARRY_RULE
                          ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                              <Option value={value.itemCode}>{value.itemName}</Option>
                            ))
                          : null}
                      </HOCSelect>
                    )}
                  </FormItem>
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="个人缴费进位规则">
                    {getFieldDecorator('empCarryRule', {
                      rules: [{ required: true, message: '请选择个人缴费进位规则' }],
                      initialValue:
                        localpolicy.changeDataMessage &&
                        localpolicy.changeDataMessage.empCarryRule &&
                        String(localpolicy.changeDataMessage.empCarryRule),
                    })(
                      <HOCSelect
                        placeholder="请选择"
                        style={{ width: '156px' }}
                        disabled={disabledSwitch}
                        onChange={e => this.selectChange('empCarryRule', e)}
                      >
                        {localpolicy.dictionaryData.CARRY_RULE
                          ? localpolicy.dictionaryData.CARRY_RULE.map(value => (
                              <Option value={value.itemCode}>{value.itemName}</Option>
                            ))
                          : null}
                      </HOCSelect>
                    )}
                  </FormItem>
                </Col>
              </Row>

              <Row>
                <Col span={12}>
                  <FormItem {...formItemLayoutModal} label="政府发文时间">
                    {getFieldDecorator('govPostTime', {
                      rules: [{ required: false, message: '请选择企业缴费进位规则' }],
                      initialValue:
                        defaultSwitch &&
                        localpolicy.changeDataMessage &&
                        localpolicy.changeDataMessage.govPostTime
                          ? moment(localpolicy.changeDataMessage.govPostTime)
                          : null,
                    })(<DatePicker style={{ width: '156px' }} />)}
                  </FormItem>
                </Col>
                <Col span={12} />
              </Row>
            </Row>
          </Form>
        </Modal>

        {/* 生成替数任务 */}
        <Modal
          title="生成替数任务"
          visible={duplicateTaskModal}
          onOk={this.duplicateTaskOk}
          onCancel={this.duplicateTaskCancel}
          footer={[
            <Button key="back" onClick={() => this.duplicateTaskCancel()}>
              取消
            </Button>,
            <Button key="submit" type="primary" onClick={() => this.duplicateTaskOk()}>
              确定
            </Button>,
          ]}
          closable={false}
          destroyOnClose
        >
          <Form layout="horizontal">
            <FormItem label="修改内容" {...formModalItemLayout}>
              {getFieldDecorator('difContent')(<span>{taskObj.difContent || '--'}</span>)}
            </FormItem>
            <FormItem label="生效年月" {...formModalItemLayout}>
              {getFieldDecorator('beginDate')(
                <span>{moment(taskObj.beginDate).format('YYYY-MM') || '--'}</span>
              )}
            </FormItem>
            {(taskObj.stopDate && (
              <FormItem label="结束年月" {...formModalItemLayout}>
                {getFieldDecorator('stopDate')(
                  <span>{moment(taskObj.stopDate).format('YYYY-MM') || '--'}</span>
                )}
              </FormItem>
            )) ||
              null}
            <FormItem
              label={
                <span>
                  <i style={{ color: 'red' }}>*</i> 差额账单处理方式
                </span>
              }
              {...formItemRadioLayout}
            >
              <DictCode
                inputType="3"
                dictType="DIFFER_HDL_WAY_TYPE"
                onChange={e => this.getValue(e)}
              />
            </FormItem>
          </Form>
        </Modal>
      </Form>
    );
  }
}
export default LocalPolicy;
